#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
   QColor color = QColorDialog::getColor(QColor(0,255,0),this,"choose the background color");
   qDebug() << color;
   char out[1024] = {0};
   sprintf(out,"background-color: rgb(%d, %d, %d);",color.red(),color.green(),color.blue());
   this->setStyleSheet(out);
}

void MainWindow::on_pushButton_2_clicked()
{
   QString filePath = QFileDialog::getSaveFileName();
   qDebug() << filePath;
}

void MainWindow::on_pushButton_3_clicked()
{
    QString filePath = QFileDialog::getOpenFileName();
    qDebug() << filePath;
}

void MainWindow::on_pushButton_4_clicked()
{
    bool ok = false;
    QFont font = QFontDialog::getFont(&ok);
    ui->pushButton_4->setFont(font);
    qDebug() << font;

}
